package main

import (
	"fmt"
	"time"
)

func main() {
	fmt.Println("Unix:", time.Now().Unix())
	fmt.Println("UnixMilli:", time.Now().UnixMilli())
	fmt.Println("UnixMicro:", time.Now().UnixMicro())
	fmt.Println("UnixNano:", time.Now().UnixNano())
	fmt.Println("IsZero:", time.Now().IsZero())
	fmt.Println("IsDST:", time.Now().IsDST())
	fmt.Println("Weekday:", time.Now().Weekday())
	i := int(time.Now().Weekday()) //OK
	//i := interface{}(time.Now().Weekday()).(int) //error
	fmt.Println("Weekday int:", i)
	fmt.Println("Year:", time.Now().Year())
	fmt.Println("YearDay:", time.Now().YearDay())
	fmt.Println("Day:", time.Now().Day())
	fmt.Println("Hour:", time.Now().Hour())
	fmt.Println("Month:", time.Now().Month())
	fmt.Println("Second:", time.Now().Second())
	fmt.Println("Nanosecond:", time.Now().Nanosecond())

	//啧啧 支持解析 1h 3m 5ms 这种
	duration, err := time.ParseDuration("3m")
	if err != nil {
		panic(err)
	}
	fmt.Println(duration)
}
